import { defineStore } from 'pinia'
import constant from '@/utils/constant'
import { Storage } from '@/utils/storage'

export const useAppStore = defineStore('appStore', {
  state: () => ({
    // 国际化
    language: Storage.getItem(constant.LangKey) || constant.defaultLanguage,
    componentSize: constant.defaultElComponentSize
  }),

  actions: {
    setLanguage(locale) {
      this.language = locale
      Storage.setItem(constant.LangKey, locale)
    }
  }
})
